1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect;
18
19 import com.google.common.annotations.GwtCompatible;
20
21 import junit.framework.TestCase;
22
23
24
25
26
27
28 @GwtCompatible
29 public abstract class AbstractImmutableTableTest extends TestCase {
30
31 abstract Iterable<ImmutableTable<Character, Integer, String>>
32 getTestInstances();
33
34 @SuppressWarnings("deprecation")
35 public final void testClear() {
36 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
37 try {
38 testInstance.clear();
39 fail();
40 } catch (UnsupportedOperationException e) {
41
42 }
43 }
44 }
45
46 @SuppressWarnings("deprecation")
47 public final void testPut() {
48 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
49 try {
50 testInstance.put('a', 1, "blah");
51 fail();
52 } catch (UnsupportedOperationException e) {
53
54 }
55 }
56 }
57
58 @SuppressWarnings("deprecation")
59 public final void testPutAll() {
60 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
61 try {
62 testInstance.putAll(ImmutableTable.of('a', 1, "blah"));
63 fail();
64 } catch (UnsupportedOperationException e) {
65
66 }
67 }
68 }
69
70 @SuppressWarnings("deprecation")
71 public final void testRemove() {
72 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
73 try {
74 testInstance.remove('a', 1);
75 fail();
76 } catch (UnsupportedOperationException e) {
77
78 }
79 }
80 }
81
82 public final void testConsistentToString() {
83 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
84 assertEquals(testInstance.rowMap().toString(), testInstance.toString());
85 }
86 }
87
88 public final void testConsistentHashCode() {
89 for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
90 assertEquals(testInstance.cellSet().hashCode(), testInstance.hashCode());
91 }
92 }
93 }